/*
 * @lc app=leetcode.cn id=2299 lang=typescript
 *
 * [2299] 强密码检验器 II
 */

// @lc code=start
function strongPasswordCheckerII(password: string): boolean {
    const special = "!@#$%^&*()-+";
    const num = "0123456789";
    const en = "qwertyuiopasdfghjklzxcvbnm";
    const p = password.split("");
    if (password.length < 8) return false;
    if (!p.some((i) => special.includes(i))) return false;
    if (!p.some((i) => num.includes(i))) return false;
    if (!p.some((i) => en.includes(i))) return false;
    if (!p.some((i) => en.toUpperCase().includes(i))) return false;

    for (let i = 1; i < password.length; i++) {
        const prev = password[i - 1];
        const element = password[i];
        if (prev === element) return false;
    }
    return true;
}
// @lc code=end
